// author:zandaoguang

import axios from 'axios'

// 创建axios实例
const service = axios.create({
    baseURL: process.env.BASE_URL, 
    timeout: 6000000
})

// request拦截器
service.interceptors.request.use(config => {
    return config
}, error => {
    // Do something with request error
    console.error(error) // for debug
    Promise.reject(error)
})

// respone拦截器
service.interceptors.response.use(response => {
    const res = response.data;
    return res;
}, error => {
    console.error(error) // for debug
    return Promise.reject(res)
})

export default service